package com.jiyun.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jiyun.mapper.ReservationMapper;
import com.jiyun.pojo.Reservation;
import com.jiyun.service.ReservationService;
import com.jiyun.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReservationServiceImpl extends ServiceImpl<ReservationMapper, Reservation> implements ReservationService {

    @Autowired
    ReservationMapper reservationMapper;
    @Override
    public R findreservation() {
        List<Reservation> list = reservationMapper.selectList(null);
        return R.ok().data("list",list);
    }

    @Override
    public R findreserById(Integer id) {
        Reservation reservation = reservationMapper.selectById(id);
        return R.ok().data("reservation",reservation);
    }

    @Override
    public R deleteReservation(Integer id) {
        reservationMapper.deleteById(id);
        return R.ok();
    }
}
